// --------------------------------------------------------------------------------------------
// Version: MPL 1.1/GPL 2.0/LGPL 2.1
// 
// The contents of this file are subject to the Mozilla Public License Version
// 1.1 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
// http://www.mozilla.org/MPL/
// 
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
// for the specific language governing rights and limitations under the
// License.
// 
// <remarks>
// Generated by IDLImporter from file nsIThreadManager.idl
// 
// You should use these interfaces when you access the COM objects defined in the mentioned
// IDL/IDH file.
// </remarks>
// --------------------------------------------------------------------------------------------
namespace Gecko
{
	using System;
	using System.Runtime.InteropServices;
	using System.Runtime.InteropServices.ComTypes;
	using System.Runtime.CompilerServices;
	
	
	/// <summary>
    /// An interface for creating and locating nsIThread instances.
    /// </summary>
	[ComImport()]
	[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
	[Guid("1be89eca-e2f7-453b-8d38-c11ba247f6f3")]
	public interface nsIThreadManager
	{
		
		/// <summary>
        /// Create a new thread (a global, user PRThread).
        ///
        /// @param creationFlags
        /// Reserved for future use.  Pass 0.
        /// @param stackSize
        /// Number of bytes to reserve for the thread's stack.
        ///
        /// @returns
        /// The newly created nsIThread object.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIThread NewThread(uint creationFlags, uint stackSize);
		
		/// <summary>
        /// Get the nsIThread object (if any) corresponding to the given PRThread.
        /// This method returns null if there is no corresponding nsIThread.
        ///
        /// @param prthread
        /// The PRThread of the nsIThread being requested.
        ///
        /// @returns
        /// The nsIThread object corresponding to the given PRThread or null if no
        /// such nsIThread exists.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIThread GetThreadFromPRThread(System.IntPtr prthread);
		
		/// <summary>
        /// Get the main thread.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIThread GetMainThreadAttribute();
		
		/// <summary>
        /// Get the current thread.  If the calling thread does not already have a
        /// nsIThread associated with it, then a new nsIThread will be created and
        /// associated with the current PRThread.
        /// </summary>
		[return: MarshalAs(UnmanagedType.Interface)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		nsIThread GetCurrentThreadAttribute();
		
		/// <summary>
        /// This attribute is true if the calling thread is the main thread of the
        /// application process.
        /// </summary>
		[return: MarshalAs(UnmanagedType.U1)]
		[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
		bool GetIsMainThreadAttribute();
	}
	
	/// <summary>nsIThreadManagerConsts </summary>
	public class nsIThreadManagerConsts
	{
		
		// <summary>
        // Default number of bytes reserved for a thread's stack, if no stack size
        // is specified in newThread(). 0 means use platform default.
        // </summary>
		public const ulong DEFAULT_STACK_SIZE = 0;
	}
}
